package eddy.yang;

import java.awt.Color;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.Toolkit;

public class RegionFilling {

	public static void main(String[] args) {

		MainFrame MF = new MainFrame();

		Rectangle screenRect = MF.getGraphicsConfiguration().getBounds();
		Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(MF.getGraphicsConfiguration());

		int centerWidth = screenRect.width < MF.getSize().width ? screenRect.x : screenRect.x + screenRect.width / 2 - MF.getSize().width / 2;
		int centerHeight = screenRect.height < MF.getSize().height ? screenRect.y : screenRect.y + screenRect.height / 2 - MF.getSize().height / 2;

		centerHeight = centerHeight < screenInsets.top ? screenInsets.top : centerHeight;

		MF.setLocation(centerWidth, centerHeight);

		MF.setDefaultLookAndFeelDecorated(true);
		Toolkit.getDefaultToolkit().setDynamicLayout(true);

		/*
		 * try{ //UIManager.setLookAndFeel(windows); //
		 * UIManager.setLookAndFeel(new MetalLookAndFeel()); }catch(Exception
		 * e){ }
		 */
		MF.setBackground(Color.lightGray);
		MF.setVisible(true);

	}
}
